﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace MGXAPI
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.MapMvcAttributeRoutes();

            //配置伪静态index，对应config配置
            //https://www.jsonfree.com/index.html
            //routes.MapRoute("News", "index.html", new { controller = "News", action = "Index" });


            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "MGX", action = "Index", id = UrlParameter.Optional }
            );


            //默认加载区域路由，只能有一个默认路由
            //routes.MapRoute(
            //     "Default",
            //    "{controller}/{action}/{id}",
            //    new { controller = "Quyu1", action = "Index", id = UrlParameter.Optional }, //这里要和Admin块下的默认控制器和action一样  
            //    new[] { "Test.Areas.Quyu.Controllers" }// 这个是你控制器所在命名空间  
            //).DataTokens.Add("area", "Quyu");
        }
    }
}
